//Page Object
Page({
  data: {
    list: []
  },
  clearScore() {
    const that = this
    wx.showModal({
      title: '提示',
      content: '你确定清空历史成绩吗？',
      success (res) {
        if (res.confirm) {
          wx.removeStorageSync('scores')
          that.setData({
            list: []
          })
        }
      }
    })
  },
  onLoad: function() {
    let scores = wx.getStorageSync('scores')
    if(scores) {
      this.setData({
        list: scores.reverse()
      })
    }
  }
});